<main>
    <table border="1px" id="users">
        <thead>
            <tr>
                <th>Subject and chapter</th>
                <th>Question description</th>
                <th>Question type</th>
                <th>Correct Answer</th>
                <th>Answer A</th>
                <th>Answer B</th>
                <th>Answer C</th>
                <th>Answer D</th>
                <th>Points for correct answer</th>
                <th>Minus points for wrong answer</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $chapter = $_SESSION['chapterPanel'];
            $subject = $_SESSION['subjectPanel'];
            $query = "SELECT * FROM questions WHERE chapterID = '$chapter' AND subjectID = '$subject'";
            $result = mysqli_query($db, $query);
            while ($row = mysqli_fetch_assoc($result)) { ?>
                <tr>
                    <td><?php echo $row['subjectID'] . ": " . $row['chapterID']; ?><br>
                        <a href="/teacher/logic/deleteUpdateQuestion.php?IDdel=<?php echo $row['questionID'] ?>">Delete</a>
                        <?php
                        $ID = $row['questionID'];
                        $type = $row['questionType'];
                        echo '<a href="/teacher/logic/deleteUpdateQuestion.php?IDupd=' . $ID . '&type=' . $type . '">Modify</a>';
                        ?>

                    </td>
                    <td><?php echo $row['questionDescription']; ?></td>
                    <td><?php echo $row['questionType']; ?></td>
                    <td><?php if ($row['questionType'] == 'TF') {
                            echo $row['answerTrueFalse'];
                        } else {
                            echo $row['answerABCD'];
                        }; ?></td>
                    <td><?php echo $row['descriptionAnswerA']; ?></td>
                    <td><?php echo $row['descriptionAnswerB']; ?></td>
                    <td><?php echo $row['descriptionAnswerC']; ?></td>
                    <td><?php echo $row['descriptionAnswerD']; ?></td>
                    <td><?php echo $row['correctPoints']; ?></td>
                    <td><?php echo $row['assHolePoints']; ?></td>
                </tr>
            <?php } ?>
        </tbody>
    </table>


</main>